#ifndef __TEMED_TASK_H__
#define __TEMED_TASK_H__
#include "common.h"

#define TIMED_TASKS_NUM_MAX		10

//typedef iotss_obj_t task_s;
typedef ETSTimer	task_timer_t;

#include "cJSON.h"

typedef struct
{
	task_timer_t timer;

	cJSON *task;

	int32_t id;
	uint32_t msgid;  //us
	struct
	{
		size_t count_set;
		size_t count_current;
		size_t loop_time;
	}loop;
}ma_timed_task_t;

extern ma_timed_task_t *ma_gp_timed_task_group[TIMED_TASKS_NUM_MAX];

FUN_ATTRIBUTE inline
bool ma_timed_task_set(
	ma_timed_task_t *task_group[],
	int32_t id,
	cJSON *task,
	size_t delaytime,
	size_t loopcount,
	size_t looptime,
	uint32_t msgid
);

bool ma_timed_task_destory(ma_timed_task_t *timed_task_group[], int32_t id);

#else

#endif